package org.myOrg.spetrum.Listener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import org.myOrg.spetrum.util.Message;
import org.myOrg.spetrum.util.MessageImplement;
import org.myOrg.spetrum.util.MessageMangement;
import org.myOrg.spetrum.util.MessageMangementImplement;
import org.myOrg.spetrum.util.OverallFactory;
import org.myOrg.spetrum.util.Sender;

public class RunListener implements ActionListener ,Sender {
	private MessageMangement mangerment;
	public RunListener(){
		this.setMessageMangement(OverallFactory.getMessageManger());
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		if (e.getActionCommand().equals("run")){
			Message msg = new MessageImplement(this,
					MessageMangementImplement.RUN, null);
			this.sendMessage(msg);
		}
	}

	@Override
	public void sendMessage(Message msg) {
		// TODO Auto-generated method stub
		mangerment.dispatchMeesage(msg);
	}

	@Override
	public void setMessageMangement(MessageMangement mangerment) {
		// TODO Auto-generated method stub
		this.mangerment = mangerment;
	}

}
